// Copyright (C) 2005 Taylor L. Riché <riche@cs.utexas.edu>
//  
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
// 
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
// 
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software 
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
//
// 	$Id: Subscription.hh 140 2005-08-13 04:39:57Z richetl $	
//

#ifndef SUBSCRIPTION_HH
#define SUBSCRIPTION_HH

#include <list>
#include <map>
#include <pthread.h>

#ifdef LEE_BUILD
#include "CourierUnit.hh"
#include "Event.hh"
#else
#include <lee/CourierUnit.hh>
#include <lee/Event.hh>
#endif

namespace lee {
  
  class CourierUnit;
  class Event;

  class Subscription
  {
  protected:
    std::map<pthread_t, CourierUnit *> * cmap;
    std::map<std::string, std::list<Subscription *> *> subMap;
  public:
    virtual ~Subscription() {}
    std::map<pthread_t, CourierUnit *> * getMap() {return cmap;}
    void setMap(std::map<pthread_t, CourierUnit *> * m) {cmap = m; return;}
    void deliver_wrapper(Event * ev);
    virtual void deliver(Event * ev) {};
    void registerSub(Subscription * s, std::string t);
    virtual void registerSubs(Subscription * masterSub) = 0;
  };

}

#endif // SUBSCRIPTION_HH
